package com.example.order.service;

import org.springframework.stereotype.Component;
import java.util.concurrent.atomic.AtomicInteger;

/**
 * 管理活跃订单数量，供监控指标使用
 */
@Component
public class ActiveOrderManager {
    private final AtomicInteger activeOrderCount = new AtomicInteger(0);

    public void increment() {
        activeOrderCount.incrementAndGet();
    }

    public void decrement() {
        activeOrderCount.decrementAndGet();
    }

    public int getActiveOrderCount() {
        return activeOrderCount.get();
    }
}
